package com.web.kdl.pojo.Bo;

import com.web.kdl.entity.flywheelDataAnalysis.FlywheelDataAnalysis;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author： shulibin
 * @Date： 2025/11/5 15:53
 * @Describe：
 */
@Data
public class MapSiteBo {
    private double sumSiteCap;
    // 统计 各飞轮的 soc值 和 系统容量
    private List<FlywheelCoreInfo> flywheelCoreInfoList;
    public void add(List<FlywheelDataAnalysis> dataDto) {
        if (this.flywheelCoreInfoList == null) {
            this.flywheelCoreInfoList = new ArrayList<>();
        }
        FlywheelCoreInfo flywheelCoreInfo = new FlywheelCoreInfo();
        for (FlywheelDataAnalysis dto : dataDto) {
            switch (dto.getDeviceName()) {
                case "系统容量":
                    this.sumSiteCap = this.sumSiteCap+dto.getDataValue();
                    flywheelCoreInfo.setFlywheelCap(dto.getDataValue());
                    break;
                case "系统SOC":
                    flywheelCoreInfo.setSoc(dto.getDataValue());
                    break;
            }
        }
        this.flywheelCoreInfoList.add(flywheelCoreInfo);
    }
    // FlywheelCoreInfo 内部类
    @Data
    public static class FlywheelCoreInfo {
        private double soc;
        private double flywheelCap;
    }
}
